#!/usr/bin/php -q
<?PHP
/* Copyright 2012-2017, Bergware International.
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License version 2,
 * as published by the Free Software Foundation.
 *
 * The above copyright notice and this permission notice shall be included in
 * all copies or substantial portions of the Software.
 */
?>
<?
$lmb = exec("nmblookup -M -- - 2>/dev/null|grep -Pom1 '^\S+'");
$self = exec("ip addr show|grep -om1 'inet $lmb '");
file_put_contents("/var/local/emhttp/localmaster.htm", $self ? "<img src='/plugins/dynamix.local.master/icons/localmaster.png' class='icon'>" : "");
?>